﻿using System.Text;

namespace msBsc.WebUi.Code
{
    public class mQtHtmlGet
    {  
        //private msBsc.AppLogic.Cfg.UserInfo ouserinfo = new AppLogic.Cfg.UserInfo(); 
        public string GetHeaderLoginInfo()
        {
            StringBuilder sbRet = new StringBuilder(); 
            if (msBsc.SvRef.UserInfo.Online)
            {
                sbRet.Append(@"<a href=""javascript:void(0);"" > " + msBsc.SvRef.UserInfo.Operator + @"</a>  | <a href=""javascript:void(0);"" onclick=""$.setLoginOut();"" > 退出</a>  ");
            }
            else
            {
                sbRet.Append(@"<a href=""/mp_Login.htm"" > 登录</a>  | <a href=""javascript:void(0);""  > 注册</a>  ");
            }
            return sbRet.ToString();
        }

        public string GetHeaderTopHtml(bool blGetLoginInfo,bool blShowGoodsClass=false)
        {
            string strtttt = "<div class=\"search-bar-cell-4\" > <a href=\"javascript:void(0);\" onclick=\"history.go(-1);\" style=\" vertical-align: middle; line-height: 28px; font-size: 16px;\">&lt;&lt;</a></div>";
            StringBuilder sbRet = new StringBuilder();
            sbRet.Append(@" 
    <header class=""search-bar"" style="" top:0px;""> 
    <form id=""J_shSearchForm"" method=""get"" action=""/m/mp_GoodsSearch.htm"">
        <div class=""search-bar-tbl"">
            <div class=""search-bar-cell-1""><a href=""javascript:void(0);""  ><img src=""/themes/mStyle1/Image/mlogo.png"" />  </a></div>
" + (blShowGoodsClass ? @"<div class=""search-bar-cell-3"" id=""GoodsClassBtn"">   <a href=""javascript:void(0);"" class=""menu"">分类</a> </div>" : strtttt) + @"            
            <div class=""search-bar-cell-2"">
                <div class=""search-textfile"">
                    <a id=""searchbtn"" href=""javascript:void(0);"" onclick=""J_shSearchForm.submit();""  class=""btn-home-search""></a>
                    <input autocomplete=""off"" name=""f"" id=""f"" class=""search-textfile-input"">
                </div>
            </div>
            <div class=""search-bar-cell-3"" id=""mymMallBtn""> 
                <a href=""javascript:void(0);"" class=""mymenu"">我的</a>
            </div>
        </div>
    </form> 
                <div class=""floor ""  id=""divmymMall"" style=""margin-bottom: 2px;margin-top: 2px; display:none;""> 
				<div class=""title-wrap"" style="" background-color:#fff; line-height:32px;  padding-left:10px;"" id=""divmyLoginInfo"">
" + (!blGetLoginInfo ? @"<a href=""/mp_Login.htm"" > 登录</a>  | <a href=""javascript:void(0);""  > 注册</a> " : GetHeaderLoginInfo()) + @"  
                </div>
                <ul class=""myMall-list"">
				                    <li class=""myMall-list-item"">
                <a href=""/mb_CustCart.htm"" class=""mymall-icon mycart""> 购物车</a> 
                    </li>
				                    <li class=""myMall-list-item""> 
                <a href=""javascript:void(0);"" class=""mymall-icon mycollGoods""> 收藏宝贝</a>  
                    </li>
				                    <li class=""myMall-list-item"">
                <a href=""/mb_ShopCollect.htm"" class=""mymall-icon mycollShop""> 收藏店铺</a>  
                    </li>
				                    <li class=""myMall-list-item"">
                <a href=""/mb_CustBought.htm"" class=""mymall-icon myallOrder""> 所有订单</a> 
                    </li>
				                </ul>
            </div>
 
    <script type=""text/javascript"">
        function initmymmall() {
            $(""#mymMallBtn"").click(function () {
                $(""#divmymMall"").toggle('fast');
            }); 
        };
        initmymmall();
    </script> 
 
</header>
"); 
     //jQuery.loadHtml('/pgajax.axd?GETLOGIN_ST=1').done(function (_rets) { if (_rets != '0' && _rets != '') { ; }    });
            return sbRet.ToString();
        }

        public string getGoodsClassHtml()
        {
            StringBuilder sbRet = new StringBuilder();
            System.Data.DataSet dst = null;
            using (Epm.AppLogic.Framework.CDbAccess oCDbAccess = new Epm.AppLogic.Framework.CDbAccess())
            {
                dst = oCDbAccess.QueryBySQL("SELECT LEVEL_ONE_ID,LEVEL_ONE_NME,SHOW_PAGE_URL,LEVEL_ONE_ICON FROM SHP_GOODS_TYPE_LEVEL_ONE ORDER BY SEQ_NUM");
            }
            
            sbRet.Append(@"
<div class=""new-ct"" id=""divGoodsClass"" style=""display:none;"">
    <div class=""new-category"">
    <div style="" position:relative;left:0px;line-height:32px; background-color:#999;"">
    <div style="" position:absolute;left:0px;top:5px;"">
                <a href=""javascript:void(0);"" class=""menu""> </a>
    </div>
    <div class=""new-category-close"" style="" ""> 
      <span>× </span>
    </div>
    <div style="" position:relative;left:30px; color:#c40000;"">商品服务分类</div>

    </div>
    <div class=""clear""></div>
        <ul class=""new-category-lst"">");
            foreach (System.Data.DataRow dr in dst.Tables[0].Rows)
            {
                sbRet.Append(@"<li class=""new-category-li""><a href=""/mp_GoodsSearch.htm?c1=" + dr["LEVEL_ONE_ID"].ToString() + @""" c1id=""" + dr["LEVEL_ONE_ID"].ToString() + @""" class=""new-category-a""> <span class=""icon""></span>" + dr["LEVEL_ONE_NME"].ToString() + "</a> </li>");
            }
            sbRet.Append(@" 
        </ul>
    </div>
</div>

    <script type=""text/javascript"">
        function initcategory() {
            $(""#GoodsClassBtn"").click(function () {
                $(""#divGoodsClass"").toggle('fast');
            });
            $("".new-category-close"").click(function () {
                $(""#divGoodsClass"").hide('fast');
            });
        };
        initcategory();
    </script> 
     ");
            return sbRet.ToString();
        }


    }
}